package cn.gson.fengboot.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
public class Zruku {
    private int rukuId;
    private TfyclientForm clientId;
    private Zreturnedgood returgoodId;
    private Zbarter barterId;
    private String rukuNo;
    private String rukuCanku;
    private String rukuFuzeren;
    private Timestamp rukuTime;
    private List<Zrukuxq> xq;

    @Id
    @Column(name = "ruku_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getRukuId() {
        return rukuId;
    }

    public void setRukuId(int rukuId) {
        this.rukuId = rukuId;
    }

    @ManyToOne
    @JoinColumn(name = "client_id", referencedColumnName = "client_id")
    public TfyclientForm getClientId() {
        return clientId;
    }

    public void setClientId(TfyclientForm clientId) {
        this.clientId = clientId;
    }

    @ManyToOne
    @JoinColumn(name = "barter_id", referencedColumnName = "barter_id")
    public Zbarter getBarterId() {
        return barterId;
    }

    public void setBarterId(Zbarter barterId) {
        this.barterId = barterId;
    }

    @ManyToOne
    @JoinColumn(name = "returgood_id", referencedColumnName = "returgood_id")
    public Zreturnedgood getReturgoodId() {
        return returgoodId;
    }

    public void setReturgoodId(Zreturnedgood returgoodId) {
        this.returgoodId = returgoodId;
    }

    @OneToMany(mappedBy = "rukuId")
    public List<Zrukuxq> getXq() {
        return xq;
    }

    public void setXq(List<Zrukuxq> xq) {
        this.xq = xq;
    }

    @Basic
    @Column(name = "ruku_no", nullable = true, length = 110)
    public String getRukuNo() {
        return rukuNo;
    }

    public void setRukuNo(String rukuNo) {
        this.rukuNo = rukuNo;
    }

    @Basic
    @Column(name = "ruku_canku", nullable = true, length = 110)
    public String getRukuCanku() {
        return rukuCanku;
    }

    public void setRukuCanku(String rukuCanku) {
        this.rukuCanku = rukuCanku;
    }

    @Basic
    @Column(name = "ruku_fuzeren", nullable = true, length = 255)
    public String getRukuFuzeren() {
        return rukuFuzeren;
    }

    public void setRukuFuzeren(String rukuFuzeren) {
        this.rukuFuzeren = rukuFuzeren;
    }

    @Basic
    @Column(name = "ruku_time", nullable = true)
    public Timestamp getRukuTime() {
        return rukuTime;
    }

    public void setRukuTime(Timestamp rukuTime) {
        this.rukuTime = rukuTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Zruku zruku = (Zruku) o;
        return rukuId == zruku.rukuId &&
                Objects.equals(returgoodId, zruku.returgoodId) &&
                Objects.equals(barterId, zruku.barterId) &&
                Objects.equals(rukuCanku, zruku.rukuCanku) &&
                Objects.equals(rukuFuzeren, zruku.rukuFuzeren) &&
                Objects.equals(rukuTime, zruku.rukuTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(rukuId, returgoodId, barterId, rukuCanku, rukuFuzeren, rukuTime);
    }
}
